local firebow = fk.CreateSkill{
    name = "xuanhur__hs__firebow",
}

local H = require "packages.ol_hegemony.util"

firebow:addEffect(fk.TargetSpecified,{
    anim_type = "offensive",
    can_trigger = function(self, event, target, player, data)
        if not (target == player and player:hasSkill(self)) then return end
        local to = data.to
        return data.card.trueName == "slash" and to.hp >= player.hp
      end,
      on_use = function(self, event, target, player, data)
        local choices = {"xuanhur_firebow-damage","xuanhur_firebow-qiangzhong"}
        local room = player.room
        local choice = room:askToChoice(player,{
            choices = choices,
            skill_name = firebow.name,
            prompt = "#xuanr_firebow-chosen",
        })
        if choice == "xuanhur_firebow-damage" then
          data.additionalDamage = (data.additionalDamage or 0) + 1
        else
          data.disresponsive = true
        end
      end,
})

firebow:addEffect("atkrange",{--五虎将大旗距离+1
    correct_func = function(self, from, to)
        if from:hasSkill(firebow.name) and from:hasShownSkill(firebow.name) then
            if H.hasHegLordSkill(Fk:currentRoom(), from, "shouyue") then
              return 1
            end
        end
        return 0
      end,
})

firebow:addEffect("targetmod",{
    bypass_distances =  function(self, player, skill, card, target)
        if skill.trueName == "slash_skill" and player:hasSkill(firebow.name) and player:hasShownSkill(firebow.name) then
          return card and target and target:getHandcardNum() <= player:getHandcardNum()
          end
      end,
})

Fk:loadTranslationTable{
   ["xuanhur__hs__firebow"] = "烈弓",
   [":xuanhur__hs__firebow"] = "你对手牌数小于等于你的角色使用【杀】无距离关系的限制。当你使用【杀】指定一个目标后，若其体力值大于等于你，你可以选择一项：1.令此【杀】对其造成的伤害+1；2.令其不能使用【闪】响应此【杀】。",
   ["xuanhur_firebow-damage"] = "此【杀】的伤害+1",
   ["xuanhur_firebow-qiangzhong"] = "此【杀】不可被响应",
   ["#xuanr_firebow-chosen"] =  "烈弓：选择一项",

   ["$xuanhur__hs__firebow1"] = "龙骨成镞，矢破苍穹。",
   ["$xuanhur__hs__firebow2"] = "凤翎为羽，箭没坚城。",
}

return firebow